package com.huangmb.anymark.server.dao.impl;

import com.huangmb.anymark.server.dao.MarkerDao;
import com.huangmb.anymark.server.model.Category;
import com.huangmb.anymark.server.model.Marker;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 用户标记DAO的实现类
 * @author hmb
 * @version 1.0
 * @since 2016/5/4 21:26
 */
@Repository(value = "markerDao")
public class MarkerDaoImpl extends BaseDaoImpl<Marker> implements MarkerDao {
    @Override
    @SuppressWarnings("unchecked")
    public List<Marker> getByIds(Integer[] ids) {
        String hql = "from Marker where id in (:ids)";
        Query query = getSession().createQuery(hql);
        query.setParameterList("ids",ids);
        return query.list();
    }

    @Override
    @SuppressWarnings("unchecked")
    public List<Category> getAllCategory() {
        String hql = "from Category";
        Query query = getSession().createQuery(hql);
        return query.list();
    }
}
